import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from "path";
// https://vitejs.dev/config/
export default defineConfig({
  base: "./",
  css: {
    modules: {
      generateScopedName: "[name]_[local]_[hash:base64:5]",
    },
    preprocessorOptions: {
      less: {
        // 支持内联 JavaScript
        javascriptEnabled: true,
      },
    },
  },
  resolve:{
    preserveSymlinks:true,
    alias:[
      {
        find: /^~antd/,
        replacement: path.resolve("./", "node_modules/antd/"),
      },
      { find: "@", replacement: path.resolve("./", "src") },
    ]
  },
  server:{
    proxy:{
      '/system': {
        // target: 'http://114.115.208.249:8080',
        target: 'http://localhost:3001/',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/system/, 'system')
      }
    }
  },
  plugins: [
    react(),
  ]
})
